
//
//  ExhibitionDetailController.m
//  PASystem
//
//  Created by 刘沿 on 16/8/23.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "ExhibitionDetailController.h"
#import "ExhibitionDetailModel.h"
#import "ExbitionIntroView.h"
#import "ExbitionContentView.h"
#import "ExhibitionCompanyModel.h"
#import "ExbitionCompanyCell.h"

@interface ExhibitionDetailController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView *tabV;

@property (nonatomic,strong) UITableView *tab2;

@property (nonatomic,strong) NSMutableArray *dataArray;

@property (nonatomic,strong) NSMutableArray *dataArray2;

@property (nonatomic,strong) UIScrollView *btnV;

@property (nonatomic,strong) UIView *view3;

@property (nonatomic,strong) ExbitionIntroView *exV;

//@property (nonatomic,strong) ExbitionContentView *conV;
@property (nonatomic,strong) UIButton *lastBtn;

@end

@implementation ExhibitionDetailController

static NSString *const ID = @"ExhibitionProjectCell";

static NSString *const COMPANY= @"companyCell";


-(NSMutableArray *)dataArray{
    if (_dataArray == nil) {
        
        _dataArray = [NSMutableArray array];
    }
    
    return _dataArray;
}

-(NSMutableArray *)dataArray2{

    if (_dataArray2 == nil) {
        
        _dataArray2 = [NSMutableArray array];
    }

    return _dataArray2;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
    CGFloat H = self.view.height *2 / 5;
    
    UITableView *tabV = [[UITableView alloc] init];
    
    self.tabV = tabV;
    
    tabV.dataSource = self;
    
    tabV.delegate = self;
    
    [self.view addSubview:tabV];
    
    [tabV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.view.mas_top);
        
        make.left.equalTo(self.view.mas_left);
        
        make.right.equalTo(self.view.mas_right);
        
        make.height.equalTo(@(H));
    }];
    
    __weak typeof (self) weakSelf = self;
    
    [self.tabV addHeaderWithCallback:^{
        
        [weakSelf loadData]; //加载网络数据
        
    }];
    [self.tabV headerBeginRefreshing];


}
- (void)loadData{
    
    NSString * userId = [[NSUserDefaults standardUserDefaults]objectForKey:@"userId"];
    NSString * pwdId = [[NSUserDefaults standardUserDefaults]objectForKey:@"pwdId"];
    NSString * userHumber = [[NSUserDefaults standardUserDefaults]objectForKey:@"userHumber"];
    
    NSString *json = [NSString stringWithFormat:@"{'action': zlxmMch,'service': %@, 'userName':'%@','password':'%@', 'vaueJson':'{userid :%@,id:%@}'}",_service,userId,pwdId,userHumber,self.ID];
    
    NSArray * array = @[@{@"arg0":json}];
    
    [HttpTools requestWithURL:BaseURL arrays:array method:Basemethod success:^(id JSON) {
        [self.dataArray removeAllObjects];
        NSDictionary *dict = JSON[@"reason"];
      
        NSDictionary *dict2 = dict[@"attrs"];
        
        ExhibitionDetailModel *model = [ExhibitionDetailModel mj_objectWithKeyValues:dict2];
        
        [self.dataArray addObject:model];
        
        [self.tabV headerEndRefreshing];
        
        [self.tabV reloadData];
        
        [self setUp:nil];
        
    } failure:^(NSError *error) {
        
        
    }];
    
    
}

//设置页面
- (void)setUp:(NSMutableArray *)arr1{
    
    //按钮的父控件
    UIScrollView *btnView = [[UIScrollView alloc] init];
    
    self.btnV = btnView;
    
    [btnView setContentSize:CGSizeMake(self.view.frame.size.width + 50, 44)];
    
    btnView.backgroundColor = [UIColor grayColor];
    
    [self.view addSubview:btnView];
    
    [btnView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.tabV.mas_bottom);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.height.equalTo(@44);
    }];

    NSArray *arr = @[@"展会介绍",@"展会内容",@"行程安排",@"出团材料",@"本会总结",@"参展企业"];
    CGFloat ViewW = self.view.frame.size.width;
    
    CGFloat w = 0;//保存前一个button的宽以及前一个button距离屏幕边缘的距离
    CGFloat h = 0;//用来控制button距离父视图的高
    for (int i = 0; i < arr.count; i ++) {
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        
        if (i == 0) {
            self.lastBtn = btn;
            [self.lastBtn setBackgroundColor:[UIColor lightGrayColor]];
        }
        
        [btn setTitle:arr[i] forState:UIControlStateNormal];
        [btn.titleLabel setFont:[UIFont systemFontOfSize:13]];
        
        [btn addTarget:self action:@selector(BtnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        btn.tag = i;
        
        //计算大小
        NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:13]};
        CGFloat length = [arr[i] boundingRectWithSize:CGSizeMake(ViewW, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size.width;
        
        btn.frame = CGRectMake(w +10, h, length , 44);
        
        w = btn.frame.size.width + btn.frame.origin.x;
        
        [btnView addSubview:btn];
        
    }

//下面切换的view
    UIView *view3 = [[UIView alloc] init];
    
    self.view3 = view3;
    
    [self.view addSubview:view3];
    
    [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(btnView.mas_bottom);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
    }];
    
//展会介绍
    ExbitionIntroView *exV = [ExbitionIntroView WithExbitionIntroView];
    
    self.exV = exV;
    
    [self.view3 addSubview:exV];
    
    [exV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.view3.mas_top);
        
        make.left.equalTo(self.view3.mas_left);
        
        make.right.equalTo(self.view3.mas_right).mas_offset(-5);
        
        make.bottom.equalTo(self.view3.mas_bottom).mas_offset(-5);
    }];
    
    
    ExhibitionDetailModel *model = self.dataArray.firstObject;
    
    exV.model = model;
    
}

#pragma mark----按钮点击事件

- (void)BtnClick:(UIButton *)btn{
    
    [self.lastBtn setBackgroundColor:[UIColor grayColor]];
    
    [btn setBackgroundColor:[UIColor lightGrayColor]];
    
    self.lastBtn = btn;

    ExhibitionDetailModel *model = self.dataArray.firstObject;

    if ([btn.titleLabel.text isEqualToString:@"展会介绍"]) {
        
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
        
        [self.view3 addSubview:self.exV];
        
        [self.exV mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.btnV.mas_bottom);
            make.left.equalTo(self.view.mas_left);
            make.right.equalTo(self.view.mas_right);
            make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
        }];
        
    }else if([btn.titleLabel.text isEqualToString:@"展会内容"]){
        
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
        ExbitionContentView *conV = [ExbitionContentView WithExbitionContentView];
        conV.type = 1;

        conV.model = model;
        
        
        [self.view3 addSubview:conV];
        
        [conV mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.btnV.mas_bottom);
            make.left.equalTo(self.view.mas_left);
            make.right.equalTo(self.view.mas_right);
            make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
        }];
        
    }else if([btn.titleLabel.text isEqualToString:@"行程安排"]){
        
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
        
        ExbitionContentView *conV = [ExbitionContentView WithExbitionContentView];
        
        conV.type = 2;
        
        conV.model = model;
                
        conV.titleLabel.text = @"行程安排:";
        
        [self.view3 addSubview:conV];
        
        [conV mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.btnV.mas_bottom);
            make.left.equalTo(self.view.mas_left);
            make.right.equalTo(self.view.mas_right);
            make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
        }];
        
    }else if([btn.titleLabel.text isEqualToString:@"出团材料"]){
        
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
        
        ExbitionContentView *conV = [ExbitionContentView WithExbitionContentView];
        conV.type = 3;
        
        conV.model = model;
        
        conV.titleLabel.text = @"出团材料:";
        
        [self.view3 addSubview:conV];
        
        [conV mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.btnV.mas_bottom);
            make.left.equalTo(self.view.mas_left);
            make.right.equalTo(self.view.mas_right);
            make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
        }];
        
    }else if([btn.titleLabel.text isEqualToString:@"本会总结"]){
    
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
        
        ExbitionContentView *conV = [ExbitionContentView WithExbitionContentView];
        conV.type = 4;
        
        conV.model = model;
        
        conV.titleLabel.text = @"本会总结:";
        
        [self.view3 addSubview:conV];
        
        [conV mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.btnV.mas_bottom);
            make.left.equalTo(self.view.mas_left);
            make.right.equalTo(self.view.mas_right);
            make.bottom.equalTo(self.view.mas_bottom).mas_offset(-49);
        }];
    
    }else{
        
        [self.view3.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
   //展会企业按钮点击
        UITableView *tab2 = [[UITableView alloc] init];
        
        tab2.delegate = self;
        
        tab2.dataSource = self;
        
        self.tab2 = tab2;
        
        tab2.backgroundColor = [UIColor whiteColor];
        
        [self.view3 addSubview:tab2];
        
        [tab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.equalTo(self.view3.mas_top);
            
            make.left.equalTo(self.view3.mas_left);
            
            make.right.equalTo(self.view3.mas_right);
            
            make.bottom.equalTo(self.view3.mas_bottom);
        }];
        
        [self companyData];
    }

}

#pragma mark----企业按钮网络方法

- (void)companyData{

    NSString * userId = [[NSUserDefaults standardUserDefaults]objectForKey:@"userId"];
    NSString * pwdId = [[NSUserDefaults standardUserDefaults]objectForKey:@"pwdId"];
    NSString * userHumber = [[NSUserDefaults standardUserDefaults]objectForKey:@"userHumber"];
    
    NSString *json = [NSString stringWithFormat:@"{'action': zlxmqyList,'service': ZlbdeptService, 'userName':'%@','password':'%@', 'vaueJson':'{userid :%@,id:%@}'}",userId,pwdId,userHumber,self.ID];
    
    NSArray * array = @[@{@"arg0":json}];
    
    [HttpTools requestWithURL:BaseURL arrays:array method:Basemethod success:^(id JSON) {
       
        NSArray *arr = JSON[@"reason"];
        
        for (NSDictionary *dict in arr) {
            
            NSDictionary *dict1 = dict[@"attrs"];
            
            ExhibitionCompanyModel *model = [ExhibitionCompanyModel mj_objectWithKeyValues:dict1];
            
            [self.dataArray2 addObject:model];
            
        }
        
        [self.tab2 reloadData];
        
        
    } failure:^(NSError *error) {
        
        
    }];


}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if (tableView == self.tabV) {
        
        return 12;

    }else{
        
        return self.dataArray2.count;
    }
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (tableView == self.tabV) {
        
        
        ExhibitionDetailModel *model = self.dataArray.firstObject;
        
        if (indexPath.row == 0) {
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10,80, 40)];
            
            label.text = @"审核状态:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            if ([model.REPLY isEqualToString:@"0"]) {
                
                lbl2.text = @"未送审";
                
            }else if ([model.REPLY isEqualToString:@"1"]){
                
                lbl2.text = @"送审";
                
                
            }else if ([model.REPLY isEqualToString:@"2"]){
                lbl2.text = @"展览部通过审核";
                
                
                
            }else if ([model.REPLY isEqualToString:@"-2"]){
                lbl2.text = @"展览部未通过审核";
                
                
                
            }else if ([model.REPLY isEqualToString:@"3"]){
                
                lbl2.text = @"国家通过审核";
                
            }else{
                
                lbl2.text = @"国家未通过审核";
                
            }
            
            lbl2.textAlignment = NSTextAlignmentRight;
            
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }else if (indexPath.row == 1){
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"展会名称:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.text = model.NAME;
            
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            return cell;
            
        }
        else if (indexPath.row == 2){
            
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"主办单位:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            lbl2.text = model.HOST;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
            
        }
        else if (indexPath.row == 3){
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10,80, 40)];
            
            label.text = @"展会地点:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            lbl2.text = model.ADDRESS;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }
        else if (indexPath.row == 4){
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"参考费用:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            lbl2.text = model.COST;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
        }
        else if (indexPath.row == 5){
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"展摊面积:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            lbl2.text = model.BOOTHAREA;
            
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            return cell;
            
        }
        else if (indexPath.row == 6){
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"展馆名称:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.text = model.HALLNAME;
            
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }
        else if (indexPath.row == 7){
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"起止时间:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            //时间戳转时间
            NSString *string = model.ENDDATE;
            NSDateFormatter *fmt = [[NSDateFormatter alloc] init];
            fmt.dateFormat = @"MMM d, yyyy HH:mm:ss aa";
            fmt.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en-US"];
            NSDate *date = [fmt dateFromString:string];
            NSDateFormatter *fm = [[NSDateFormatter alloc] init];
            fm.dateFormat = @"yyyy-MM-dd";
            NSString *selfYear = [fm stringFromDate:date];
            lbl2.text = selfYear;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
        }
        else if (indexPath.row == 8){
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"展会类型:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.text = model.EDNAME;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
        }
        else if (indexPath.row == 9){
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"展会频率:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.font = [UIFont systemFontOfSize:15];
            
            lbl2.text = model.FREQUENCY;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }
        else if (indexPath.row == 10){
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 80, 40)];
            
            label.text = @"摊位总数:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.text = model.BOOTHNUM;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }
        else if (indexPath.row == 11){
            
            UITableViewCell* cell = [[UITableViewCell alloc]init];
            
            UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 120, 40)];
            
            label.text = @"我司参与人数:";
            
            label.font = [UIFont systemFontOfSize:15];
            
            [cell.contentView addSubview:label];
            
            UILabel *lbl2 = [[UILabel alloc] init];
            
            lbl2.font = [UIFont systemFontOfSize:15];
            lbl2.textAlignment = NSTextAlignmentRight;
            
            lbl2.text = model.JOINMAN;
            [cell.contentView addSubview:lbl2];
            
            [lbl2 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(label.mas_centerY);
                make.left.equalTo(label.mas_right);
                make.height.equalTo(label.mas_height);
                make.right.equalTo(cell.contentView.mas_right).mas_offset(-5);
            }];
            
            
            return cell;
            
        }else{
            
            return nil;
            
        }
        
    }else if(tableView == self.tab2){
    //参展企业的详情
        ExhibitionCompanyModel *model = self.dataArray2[indexPath.row];
        
        ExbitionCompanyCell *cell = [tableView dequeueReusableCellWithIdentifier:COMPANY];
        
        if (cell == nil) {
            
            cell = [ExbitionCompanyCell WithExbitionCompanyCell];
        }
        
        cell.model = model;
        
        return cell;
    }else{
    
        return nil;
    }
    

}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (tableView == self.tabV) {
        
        return 44;
    }else{
    
        return 210;
    }


}




@end
























